﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using BCCommon.OAEnums;
using BCEntity.OA.Attendance.AttendanceCheckInRecord;

namespace BCData.OA.Attendance.AttendanceCheckInRecord
{
    public interface IAttendanceCheckInRecordData
    {
        /// <summary>
        /// 新增一条考勤打卡记录
        /// </summary>
        /// <param name="entitys">打卡信息</param>
        /// <returns></returns>
        Task<AttendanceCheckInRecordEntity> InserAsync(AttendanceCheckInRecordEntity entity);

        /// <summary>
        /// 修改一条考勤打卡记录
        /// </summary>
        /// <param name="entitys">打卡信息</param>
        /// <returns></returns>
        Task<AttendanceCheckInRecordEntity> UpdateAsync(AttendanceCheckInRecordEntity entity);

        /// <summary>
        ///删除一条考勤打卡记录
        /// </summary>
        /// <param name="checkInRecordId">打卡Id</param>
        /// <returns></returns>
        Task<int> DeleteAsync(string adminName, long checkInRecordId);

        /// <summary>
        /// 获取打卡记录详情信息
        /// </summary>
        /// <param name="checkInRecordId">打卡记录Id</param>
        /// <returns></returns>
        Task<AttendanceCheckInRecordEntity> GetAsync(long checkInRecordId);
        /// <summary>
        /// 校验打卡记录是否存在
        /// </summary>
        /// <param name="checkInRecordId"></param>
        /// <returns></returns>
        Task<bool> CheckIsExists(long checkInRecordId);

        /// <summary>
        /// 获取指定员工所在日期内的打卡记录
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <param name="date">指定日期</param>
        /// <returns></returns>
        Task<IEnumerable<AttendanceCheckInRecordEntity>> GetByAsync(long adminId, int departmentId, DateTime date);

        /// <summary>
        /// 更新指定的打卡记录时间为最新时间
        /// </summary>
        /// <param name="checkInRecordId">指定的打卡记录</param>
        /// <param name="adminName">修改人</param>
        Task<AttendanceCheckInRecordEntity> UpdateCheckInTimeAsync(long checkInRecordId, string adminName, long adminId);

        /// <summary>
        /// 判断该时间段有木有打卡记录
        /// </summary>
        /// <param name="adminId">当前员工功能</param>
        /// <param name="groupId">所在考勤组</param>
        /// <param name="classId">班次</param>
        /// <param name="baseCheckInTime">基准时间</param>
        /// <returns></returns>
        Task<AttendanceCheckInRecordEntity> GetIsExistsByTime(long adminId, long groupId, long classId, string baseCheckInTime);

        /// <summary>
        /// 分页获取打卡记录信息
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="adminDto">当前登录管理员</param>
        /// <param name="pageIndex">分页页码</param>
        /// <param name="pageSize">分页页数</param>
        /// <param name="ascending">是否升序</param>
        /// <param name="sourceType">来源类型</param>
        /// <param name="status">打卡状态</param>
        /// <param name="checkInType">打卡方式</param>
        /// <param name="startTime">打卡开始时间</param>
        /// <param name="endTime">打卡结束时间</param>
        /// <returns></returns>
        Task<(IEnumerable<AttendanceCheckInRecordEntity>, int)> GetListAsync(int companyId, long adminId, int pageIndex, int pageSize, bool? ascending, SourceType? sourceType, CheckInStatus? status, CheckInType? checkInType, DateTime? startTime = null, DateTime? endTime = null, int? departmentId = null);
    }
}
